package tk.mybatis.springboot.provider;

import org.apache.ibatis.jdbc.SQL;

import tk.mybatis.springboot.model.City;

public class TestProvider {

	public String selectAll(final City city) {
		return new SQL(){{
			SELECT("*");
			FROM("city");
			if(city.getId() !=null ){
				WHERE("id = #{id}");
			}
			if(city.getName() !=null ){
				WHERE("name = #{name}");
			}
			if(city.getState() !=null ){
				WHERE("state = #{state}");
			}
		}}.toString();
	}
}
